package com.example.demo.service;

import com.example.demo.entity.Userinfo;
import com.example.demo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     *  注册
     */
    public Integer register(Userinfo userinfo) {
        return userMapper.register(userinfo);
    }

    /**
     *  登录
     */
    public Userinfo getUserByName(String username) {
        return userMapper.getUserByName(username);
    }

    /**
     *  7. 根据用户id查询列表页用户信息
     */
    public Userinfo getUserById(Integer id) {
        return userMapper.getUserById(id);
    }
}
